package com.baizhi.action;

import com.baizhi.entity.User;
import com.baizhi.service.impl.UserServiceImpl;
import com.baizhi.utli.MD5Utils;

public class UserAction {
    private String userName;
    private String userPassword;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }




    public String login(){
        UserServiceImpl service = new UserServiceImpl();
        System.out.println("进来");
        User user = service.selectUserByName(userName);
        if(user!=null && user.getUserPassword().equals(MD5Utils.digest(userPassword))){
            return "loginOK";
        }else {
            return "loginNO";
        }
    }
}
